package http

import (
	sessionHandler "gitee.com/zaiqiang231/go-base-session/app/http/handler"
	httpHandler "gitee.com/zaiqiang231/zcamp-service-user/app/http/handler"
	"github.com/gin-gonic/gin"
)

func InitRouter(g *gin.Engine) {
	g.Use(gin.Logger(), gin.Recovery())
	//跨域 设置
	g.Use(sessionHandler.Cors())
	//原子参数
	g.Use(sessionHandler.AtomFunc)

	user := g.Group("/user")
	{
		user.GET("/captcha", httpHandler.Captcha) //获取验证码
		user.POST("/login", httpHandler.LoginHandler)
		user.GET("/getSelfUserInfo", httpHandler.AuthCheckFunc, httpHandler.UserSelfGet)

		user.POST("/createUser", httpHandler.AuthCheckFunc, httpHandler.CreateUser)
		user.POST("/updateUser", httpHandler.AuthCheckFunc, httpHandler.UpdateUser)
		user.POST("/deleteUserList", httpHandler.AuthCheckFunc, httpHandler.DeleteUserList)
		user.POST("/getUserList", httpHandler.AuthCheckFunc, httpHandler.GetUserList)

		user.POST("/getSmsCode", httpHandler.GetSmsCodeHandler) //获取手机验证码
		user.POST("/phoneLogin", httpHandler.PhoneLoginHandler) //手机验证码登录
		user.POST("/getLoginUserInfo", httpHandler.AuthCheckFunc, httpHandler.LoginUserInfo)

		user.GET("/relation/follow", httpHandler.AuthCheckFunc, httpHandler.Follow)
		user.GET("/relation/unfollow", httpHandler.AuthCheckFunc, httpHandler.UnFollow)
		user.GET("/relation/numrelations", httpHandler.NumRelations)
		user.GET("/relation/relation", httpHandler.Relation)
		user.GET("/relation/follow/recommend", httpHandler.FollowRecommend)
	}

}
